package data.composition.factory;

import cn.hutool.core.bean.BeanUtil;
import lombok.Data;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * @author ZhangJinyu
 * @since 2024-12-13
 */
@Data
public class Teacher {
    private Long id;
    private String name;
    private String gender;

    public static List<Teacher> demo1() {
        List<Teacher> teachers = new LinkedList<>();
        for (int i = 0; i < 10; i++) {
            Teacher teacher = new Teacher();
            teacher.setId((long) (i + 1));
            teacher.setName("老师:" + i);
            teacher.setGender(i % 2 == 0 ? "男" : "女");
            teachers.add(teacher);
        }
        return teachers;
    }
    public static List<Map<String, Object>> demo2() {
        return demo1().stream().map(BeanUtil::beanToMap).toList();
    }
}
